const path = require('path')

module.exports = {
  devServer: {
    port: 1109,
    open: true,
    proxy: { // 服务器的反向代理
      '/api': {
        target: 'http://rap2api.taobao.org/app/mock/279365/api',
        // target   一定是自己接口的端口号
        changeOrigin: true,
        pathRewrite: {
          '^/api': ''
        }
      }
    }

  },
  lintOnSave: true,
  chainWebpack: config => {
    config.resolve.alias
      .set('@', path.join(__dirname, 'src'))
      .set('views', path.join(__dirname, 'src/views'))
      .set('utils', path.join(__dirname, 'src/utils'))
      .set('api', path.join(__dirname, 'src/api'))
      .set('router', path.join(__dirname, 'src/router'))
      .set('components', path.join(__dirname, 'src/components'))
      .set('assets', path.join(__dirname, 'src/assets'))
      .set('store', path.join(__dirname, 'src/store'))
  }
}
